Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
Remove "filename" header from FormData

I'm trying to post a request using FormData(), I need to include the "content type" header so I'm using the blob to append entries to my form, but this automatically sets the filename to "blob"

const formData = new FormData();

        const obj1 = new Blob([json_data], {type: 'text/plain; encoding=utf-8'});
        formData.append("small_config", obj1);

        const obj2 = new Blob([client], {type: 'text/plain; encoding=utf-8'});
        formData.append("app_type", obj2);

        const obj3 = new Blob([version], {type: 'text/plain; encoding=utf-8'});
        formData.append("product_version", obj3);

        let thumb = await fetch(my_url, {
            method: 'POST',
            mode: 'cors',
            cache: 'no-cache',
            credentials: 'same-origin',
            redirect: 'follow',
            referrerPolicy: 'no-referrer',
            body: formData
        });

Is there a way to both set the content type and not include filename?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There is no way to have FormData not send a filename with an appended blob. You can send an empty string however.

Use the 3rd parameter to FormData.append

formData.append("small_config", obj1, 'My Filename');

So for your case, try an empty string.

formData.append("small_config", obj1, '');

From Mozilla docs:

filename Optional
The filename reported to the server (a USVString), when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda